<?
$method = $this->router->method;
?>

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="<?= SCRIPT_PATH ?>js/libs/jquery-1.10.1.min.js"><\/script>')</script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery-migrate-1.0.0.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.dropdownized.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.validate.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/hoverIntent.js"></script>

<!--[if (gte IE 6)&(lte IE 8)]>
  <script type="text/javascript" src="<?= SCRIPT_PATH ?>js/libs/selectivizr-min.js"></script>
<![endif]--> 

<? if ($this->lang->mci_current() != 'en'): ?>
<script src="<?= SCRIPT_PATH ?>js/libs/datepicker_regional/jquery.ui.datepicker-<?= $this->lang->mci_current() ?>.js"></script>

<? endif; ?>

<script type="text/javascript">

    var API = API || {};
    API = {
        Data: {
            base_url: '<?= base_url(); ?>',
            libs_url: '<?= SCRIPT_PATH; ?>',
            lang_url: '<?= lang_url(); ?>',
            method: '<?= $this->router->fetch_method(); ?>',
            cur_lang: '<?= $this->lang->mci_current(); ?>',
            HOST_URL_HOTELS: '<?= HOST_URL_HOTELS; ?>',
            lang: {
                'top_custom_search': "<?= lang('top.custom_search'); ?>",
                'form_dest_region': "<?= lang('form.dest_region'); ?>",
                'form_person': "<?= lang('form.person'); ?>",
                'form_persons': "<?= lang('form.persons'); ?>",
                'form_show_all_items': "<?= lang('form.show_all_items'); ?>",
                'filter_filtering': "<?= lang('filter.filtering'); ?>",
                'dtl_adults': "<?= lang('dtl.adults'); ?>",
                'dtl_teenagers': "<?= lang('dtl.teenagers'); ?>",
                'dtl_children': "<?= lang('dtl.children'); ?>",
                'dtl_babies': "<?= lang('dtl.babies'); ?>",
                'days': "<?= lang('days'); ?>",
                'book_now': "<?= lang('res.book_now'); ?>",
                'calculating': "<?= lang('calculating'); ?>",
                'dtl_subscribing': "<?= lang('dtl.subscribing'); ?>",
                'dtl_subscribe_thanks': "<?= lang('dtl.subscribe_thanks'); ?>",
                'dtl_subscribe_alredy': "<?= lang('dtl.subscribe_alredy'); ?>",
                'dtl_posting_question': "<?= lang('dtl.posting_question'); ?>",
                'dtl_posting_thanks': "<?= lang('dtl.posting_thanks'); ?>",
                'available': "<?= lang('available'); ?>",
                'occupied': "<?= lang('occupied'); ?>",
                'selected': "<?= lang('selected'); ?>",
                'arrival': "<?= lang('arrival'); ?>",
                'departure': "<?= lang('departure') ?>",
                'read_more': "<?= lang('read_more') ?>",
                'see_more': "<?= lang('see_more') ?>",
                'close': "<?= lang('close') ?>"
            }
        }
    };


</script>

<? if ($method === 'index' || $method === 'search' || $method === 'accommodation'): ?>

<script src="<?= SCRIPT_PATH ?>js/libs/jquery.colorbox-min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/form.js"></script>

<? endif; ?>

<? if ($method === 'index' || $method === 'search'): ?>

<script src="<?= base_url() ?>assets/js/form.js"></script>

<? endif; ?>

<? if ($method === 'index'): ?>

<script src="<?= SCRIPT_PATH ?>js/libs/responsiveslides.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.bxslider.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/readmore.min.js"></script>
<script src="<?= base_url() ?>assets/js/index.js"></script>

<? endif; ?>

<? if ($method === 'search' || $method === 'accommodation'): ?>

<script src="<?= SCRIPT_PATH ?>js/libs/jquery.loadmask.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.scrollTo-min.js"></script>

<? endif; ?>

<? if ($method === 'search'): ?>

<script src="<?= SCRIPT_PATH ?>js/libs/underscore-min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.multi-accordion-1.5.3.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.pajinate.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_mask.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_sorter.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_pager.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_slider.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_filter.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_main.js"></script>

<? endif; ?>

<? if ($method === 'accommodation'): ?>

<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-528e8f9f216bc320"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/readmore.min.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.thumbhover.js"></script>
<script src="<?= SCRIPT_PATH ?>js/libs/jquery.galleriffic.js"></script>
<script src="<?= base_url() ?>assets/js/accommodation.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_calculation.js"></script>
<script src="<?= SCRIPT_PATH ?>js/api/x_calendar.js"></script>
<script src="<?= base_url() ?>assets/js/calendar.js"></script>

<? endif; ?>

<script src="<?= base_url() ?>assets/js/plugins.js"></script>

<? if ($method === 'index' || $method === 'search' || $method === 'accommodation'): ?>
<script type="text/javascript">


    function downloadJSAtOnload() {  // Add a script element as a child of the body

        loadGMAPScript = function() {

            var element0 = document.createElement("script");
            element0.src = API.Data.libs_url + "js/libs/markerclusterer_packed.js";
            document.body.appendChild(element0);

            var element1 = document.createElement("script");
            element1.src = API.Data.libs_url + "js/api/x_google_map.js";
            document.body.appendChild(element1);

            var element2 = document.createElement("script");
            element2.src = API.Data.base_url + "assets/js/google_map.js";
            document.body.appendChild(element2);

        }

        var element = document.createElement("script");
        element.type = "text/javascript";
        element.src = "http://maps.googleapis.com/maps/api/js?key=AIzaSyA8S8GdXphRexN5dRL-A5o4GDvBqMFx-iI&sensor=false&callback=loadGMAPScript";
        document.body.appendChild(element);

    }

    $(window).load(function() {
        downloadJSAtOnload();
    });


</script>
<? endif; ?>

<script src="<?= base_url() ?>assets/js/main.js"></script>